body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.chat-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 15px 20px;
    background-color: #409eff;
    color: white;
    font-weight: bold;
    font-size: 18px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.message-user {
    justify-content: flex-end;
}

.message-ai {
    justify-content: flex-start;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 10px;
    flex-shrink: 0;
}

.message-content {
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 70%;
    word-break: break-word;
}

.message-user .message-content {
    background-color: #409eff;
    color: white;
    border-top-right-radius: 0;
}

.message-ai .message-content {
    background-color: #f2f6fc;
    color: #333;
    border-top-left-radius: 0;
}

.markdown-content {
    line-height: 1.6;
    font-size: 15px;
}

/* 代码块样式 */
.markdown-content pre {
    background-color: #282c34;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    position: relative;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

.markdown-content code {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

/* 行内代码样式 */
.markdown-content p code, 
.markdown-content li code, 
.markdown-content td code {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 85%;
    color: #24292f;
}

/* 代码块语言标签 */
.code-language-tag,
.detected-language {
    position: absolute;
    top: 0;
    right: 0;
    color: #d4d4d4;
    font-size: 12px;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom-left-radius: 5px;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    z-index: 1;
}

/* 表格样式 */
.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
    border-radius: 6px;
    overflow: hidden;
}

.markdown-content th, .markdown-content td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.markdown-content th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.markdown-content tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 引用样式 */
.markdown-content blockquote {
    margin: 10px 0;
    padding: 10px 15px;
    border-left: 4px solid #409eff;
    background-color: rgba(64, 158, 255, 0.1);
    color: #666;
}

/* 列表样式 */
.markdown-content ul, .markdown-content ol {
    padding-left: 20px;
}

.markdown-content li {
    margin-bottom: 5px;
}

/* 图片样式 */
.markdown-content img {
    max-width: 100%;
    border-radius: 5px;
    margin: 10px 0;
}

/* 标题样式 */
.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.25;
}

/* 数学公式样式 */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    margin: 1em 0;
    text-align: center !important;
}

.katex {
    font-size: 1.1em;
    text-indent: 0;
    text-rendering: auto;
}

.math-block {
    background-color: #f8f8f8;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    overflow-x: auto;
    text-align: center;
}

/* 行内数学公式 */
.inline-math {
    white-space: nowrap;
    padding: 0 2px;
}

/* 确保KaTeX渲染正确 */
.katex-html {
    display: none;
}

/* 修复特殊符号和代码显示问题 */
.markdown-content pre code {
    white-space: pre !important;
    word-break: normal !important;
    word-wrap: normal !important;
    tab-size: 4;
    -moz-tab-size: 4;
    font-size: 14px;
    line-height: 1.5;
    color: #e0e0e0;
}

/* 修复长公式和代码换行问题 */
.markdown-content pre, .katex-display, .math-block {
    max-width: 100%;
    overflow-x: auto;
}

/* 处理数学公式渲染错误 */
.math-error {
    color: #f56c6c;
    background-color: #fef0f0;
    border: 1px solid #f56c6c;
    padding: 8px;
    border-radius: 4px;
    white-space: normal;
    text-align: left;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
}

/* 提高代码块对比度 */
.hljs {
    color: #e0e0e0;
    background: #282c34 !important;
}

.hljs-comment,
.hljs-quote {
    color: #5c6370;
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
    color: #569CD6;
}

.hljs-function {
    color: #DCDCAA;
}

.hljs-string, 
.hljs-attr,
.hljs-attribute,
.hljs-template-tag, 
.hljs-selector-id,
.hljs-selector-class,
.hljs-quote {
    color: #ce9178;
}

.hljs-number,
.hljs-built_in {
    color: #B5CEA8;
}

.hljs-variable,
.hljs-template-variable,
.hljs-type,
.hljs-name {
    color: #e06c75;
}

.hljs-tag {
    color: #39a6dd;
}

.chat-input-area {
    padding: 15px;
    display: flex;
    border-top: 1px solid #eaeaea;
    background-color: #fff;
}

.memory-id-select {
    width: 120px;
    margin-right: 10px;
}

.streaming-indicator {
    color: #409eff;
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.dot-flashing {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #409eff;
    animation: dot-flashing 1s infinite linear alternate;
    animation-delay: .5s;
    margin-right: 5px;
}

.dot-flashing::before, .dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #409eff;
    animation: dot-flashing 1s infinite alternate;
}

.dot-flashing::before {
    animation-delay: 0s;
    margin-left: -15px;
}

.dot-flashing::after {
    animation-delay: 1s;
    margin-left: 15px;
}

@keyframes dot-flashing {
    0% {
        background-color: #409eff;
    }
    50%, 100% {
        background-color: #98c6fd;
    }
} 